package org.graduates.webapp.actions.course;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.graduates.webapp.actions.BaseAction;
import org.projects.graduates.domain.Course;

import com.opensymphony.xwork2.ActionSupport;

/**
 * 确认选修
 * 
 * @author Administrator
 * 
 */
@Action(results = { @Result(name = "success", type = "redirect", location = "studied.action", params = { "cid", "${cid}" }) })
public class CommitSelectAction extends BaseAction {

	private static final long serialVersionUID = -8918521935528458557L;

	private long cid = 0L;

	public String execute() {
		if (0L == cid) {
			return ActionSupport.INPUT;
		}

		Course course = Course.get(Course.class, cid);

		if (null == course) {
			return ActionSupport.INPUT;
		}

		this.gradApplication.selecCourse(getCurrentPerson(), course);

		return ActionSupport.SUCCESS;
	}

	public long getCid() {
		return cid;
	}

	public void setCid(long cid) {
		this.cid = cid;
	}

}
